/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.grt192.demos;

import com.grt192.core.GRTObject;
import com.grt192.mechanism.iaroc.IRCreate;
import com.grt192.spot.actuator.GRTDemoLED;
import com.grt192.spot.controller.WallHugger;
import com.grt192.spot.mechanism.WallHugger.WallHuggingBase;
import com.grt192.spot.mechanism.hauntedHouse.StatusLight;
import com.grt192.spot.sensor.GRTSonar;
import com.iaroc.irobot.IRobotCreate;
import com.sun.spot.sensorboard.EDemoBoard;

/**
 *
 * @author ajc
 */
public class WallHugDemo extends GRTObject {

    public WallHugDemo() {
        StatusLight status = new StatusLight(new GRTDemoLED(0));
        status.rawColor(GRTDemoLED.Color.ORANGE);

        //This sonar ranges from the right, about 45deg.
        GRTSonar sonar = GRTSonar.fromPWM(EDemoBoard.D4, 50, "sonar");

        log("new irobot create...");
        IRobotCreate irc = new IRobotCreate(); //hang here until play button pressed

        status.blinkonBlack();
        log("create ready!");
        IRCreate create = new IRCreate(irc);
//        IRCreate create = new IRCreate(null); //pass a null create that won't drive.
        status.rawColor(GRTDemoLED.Color.GREEN);

        WallHuggingBase base = new WallHuggingBase(create, new GRTSonar[]{sonar});

        WallHugger hugger = new WallHugger(base);
        hugger.start();
    }
}
